<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="js/jquery.js"></script>
    <script>
        $(function () {
            $("#loginBtn").click(function () {
                $.ajax({
                    url: '/user/login',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "phone": $("#phone").val(),
                        "password": $("#password").val()
                    },
                    success: result=>{
                        if (result.success) {
                            localStorage.setItem('localPhone', result.storage);
                            location.href = 'product.html';
                        } else {
                            location.href = 'userLogin.html';
                        }
                    }
                });
            });
        });
    </script>
</head>
<body>
<div id="loginForm">
    <input id="phone" placeholder="请输入手机号码">
    <input type="password" id="password" placeholder="密码">
    <button type="button" id="loginBtn">登录</button>
</div>
</body>
</html>